package com.zhentao.config;

import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;
import java.io.File;

/**
 * 导出配置类
 */
@Configuration
public class ExportConfig {

    /**
     * 初始化导出目录
     */
    @PostConstruct
    public void initExportDirectory() {
        try {
            File exportDir = new File("exports");
            if (!exportDir.exists()) {
                boolean created = exportDir.mkdirs();
                if (created) {
                    System.out.println("导出目录创建成功：exports/");
                } else {
                    System.err.println("导出目录创建失败");
                }
            } else {
                System.out.println("导出目录已存在：exports/");
            }
        } catch (Exception e) {
            System.err.println("创建导出目录时发生错误：" + e.getMessage());
        }
    }
}
